package SmartFurniture.Manager;
import SmartFurniture.Interface.SmartDevice;
import java.util.ArrayList;
import java.util.List;

//单例模式
public class DeviceManager {
    private static volatile DeviceManager instance;
    private List<SmartDevice> devices;

    private DeviceManager() {
        devices = new ArrayList<>();
    }

    public static DeviceManager getInstance() {
        if (instance == null) {
            synchronized (DeviceManager.class) {
                if (instance == null) {
                    instance = new DeviceManager();
                }
            }
        }
        return instance;
    }

    public void register(SmartDevice device) {
        devices.add(device);
        System.out.println("设备已注册到设备管理器");
    }
}
